﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Manage Events
</asp:Content>

<asp:Content id="Content3" ContentPlaceHolderID="HeaderContent" runat="server">
    <script type="text/javascript">
        $(document).ready(function()
        {
            $('#ddlYears').change(function()
            {
                GetEvents($(this));
            });

        });

        function GetEvents(obj)
        {
            
            $.ajax({
                url: '<%=Url.Action("DisplayEvents", "Event") %>',
                data: "year=" + $(obj).val(),
                success: function(data)
                {
                    $('#displayEvents').html(data);
                }
            });
        }
    </script>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
     <%= Html.ActionLink("Create new Event", "EditEvent", "Event", new {id = 0})%>
    <h2>Manage Events</h2>
    <p>
        Select a year to display the related events
    </p>
    <p>
        <%=Html.DropDownList("ddlYears", (IEnumerable<SelectListItem>)ViewData["EventYears"], "-- Choose year --")%>
    </p>
    
    <div id="displayEvents"></div>
  

</asp:Content>
